package com.mybatis.example.dao;

import com.mybatis.example.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;


public interface UserMapper {



    //查询全部用户
    @Select("select * from user;")
    List<User> getUsers();

    //根据id查询
    @Select("select * from user where id = #{id};")
    User getUserById(@Param("id")int id);

    //添加用户
    @Insert("insert into user values(#{id},#{name},#{age},#{birthday},#{email}); ")
    int addUser(User user);

    //修改用户
    @Update("update user set email = #{email} where id = #{id};")
    int updateUserEmail(@Param("id") int id,@Param("email") String email);

    //删除用户
    @Delete("delete from user where id = #{uid};")
    int deleteUser(@Param("uid") int id);

}
